-
Notifications
You must be signed in to change notification settings - Fork 378
fix(oauth): The dynamic client registration should be optional #463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
authorization_endpoint: create_endpoint("authorize"), | ||
token_endpoint: create_endpoint("token"), | ||
registration_endpoint: create_endpoint("register"), | ||
registration_endpoint: None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that supporting DCR is a SHOULD in the MCP spec, If we cannot get metadata at all and we construct these defaults, should we continue to populate a default uri here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GitHub, for example, does not provide a value for registration_endpoint
in their response, as they do not support DCR and require pre-registration of clients. (I had to make this same change in a fork, to support GitHub properly, and had not yet had an opportunity to open a PR here.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR makes dynamic client registration optional in the OAuth implementation, aligning with RFC 8414 standards. The change allows systems to function without supporting dynamic registration by providing appropriate fallback behavior.
- Changed
registration_endpoint
from requiredString
toOption<String>
- Added graceful fallback when dynamic registration is not supported
- Improved logging to use warnings instead of errors for expected fallback scenarios
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
examples/servers/src/complex_auth_sse.rs |
Wraps registration endpoint in Some() to match new optional type |
crates/rmcp/src/transport/auth.rs |
Updates struct definition, fallback logic, and error handling for optional registration |
Comments suppressed due to low confidence (2)
crates/rmcp/src/transport/auth.rs:398
- Removed error logging for HTTP status failures. Registration failures with specific HTTP status codes should be logged to help diagnose server-side issues.
return Err(AuthError::RegistrationFailed(format!(
"HTTP {}: {}",
status, error_text
)));
crates/rmcp/src/transport/auth.rs:408
- Removed error logging for JSON parsing failures. When the server returns an unparseable response, this should be logged as it indicates a protocol violation or server issue.
Err(e) => {
return Err(AuthError::RegistrationFailed(format!(
"analyze response error: {}",
e
)));
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Signed-off-by: jokemanfire <[email protected]>
@4t145 Did you forget submit your review? :) |
approved |
LGTM as well after adjusting commit message to satisfy the linter |
6cd779c
into
modelcontextprotocol:main
Change it while merge . |
The dynamic registration can be skipped, and it should be optional.
Motivation and Context
Accoding to rfc8414.
How Has This Been Tested?
No test
Breaking Changes
Types of changes
Checklist
Additional context